import React from 'react';

const PriceTable = ({ title, header, datas }) => {
  return (
    <div className='web-page-block price-table'>
      <div className='web-page-block-content background price-table-content'>
        <div className='price-table-title'>{title}</div>
        <table>
          <thead>
            <tr>
              {
                header.map(col => <th>{col.text}</th>)
              }
            </tr>
          </thead>
          <tbody>
            {
              datas.map(row => {
                return (
                  <tr>
                    {
                      header.map(col => <td>{row[col.key]}</td>)
                    }
                  </tr>
                )
              })
            }
          </tbody>
        </table>
        <br />
      </div>
    </div>
  );
}

export default PriceTable;